<?php echo js('admin/settings.js');?>
<?php echo js('jquery/popupWindow/jquery.popupWindow.js');?>
<script type="text/javascript">
	function delte_pickup_image(){
		$('#pickup_image_holder').html("");
		$('#pickup_image').val("");
	}
	jQuery(function($){
		$('#a_pickup').popupWindow({height:500, width:800, centerBrowser:1}); 
	});
</script>
<script type="text/javascript">
$(function()
{
	<?php if(empty($tour->departuredate_from)):?>
		var date_from = new Date().asString();
	<?php else:?>
		var date_from = '<?php echo date('d/m/Y', $tour->departuredate_from)?>';
	<?php endif;?>
	<?php if(empty($tour->departuredate_to)):?>
		var date_to = new Date().asString();
	<?php else:?>
		var date_to = '<?php echo date('d/m/Y', $tour->departuredate_to)?>';
	<?php endif;?>
	$('#departuredate_from').datePicker({clickInput:true}).val(date_from).trigger('change');
	$('#departuredate_to').datePicker({clickInput:true}).val(date_to).trigger('change');
});
</script>
<div id="page-heading"><h1><?php echo sprintf(lang('tours.edit_title'), def_lang($tour, 'name')) ?></h1></div>
<?php $this->load->view('partials/notices'); ?>
<form method="post" action="<?php echo site_url('admin/catalog/edit_tour/'. $tour->id);?>" >
<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		<tr>
			<th valign="top"><?php echo lang('tours.is_hotsale'); ?><span class="require">*</span>:</th>
			<td><?php echo form_dropdown('is_hotsale', array(1 => lang('global:yes'), 0 => lang('global:no')), $tour->is_hotsale, 'id="is_hotsale" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.available_label'); ?><span class="require">*</span>:</th>
			<td><?php echo form_dropdown('available', array(1 => lang('global:yes'), 0 => lang('global:no')), $tour->available, 'id="available" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.channel_id'); ?><span class="require">*</span>:</th>
			<?php 
			$channels_option = array();
			foreach($channels as $channel){
				$channels_option[$channel->id] = empty($channel->name)? lang('global:empty'): $channel->name;
			}
			?>
			<td><?php echo form_dropdown('channel_id', $channels_option, $tour->channel_id, 'id="channel_id" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.type'); ?><span class="require">*</span>:</th>
			<td><?php echo form_dropdown('type', array(lang('tours.suit') => lang('tours.suit'), lang('tours.short_distance') => lang('tours.short_distance')), $tour->type, 'id="type" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.serial'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('serial', $tour->serial, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.uri_segment'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('uri_segment', $tour->uri_segment, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.price'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('price', $tour->price, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.discountprice'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('discountprice', $tour->discountprice, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.departure_day'); ?><span class="require">*</span>:</th>
			<td>
			<?php foreach(array(1,2,3,4,5,6,7) as $day):?>
				<?php echo form_checkbox(array('id'=>'days', 'name'=>'departure_day[]', 'value'=> $day, 'checked'=> in_array($day, $tour->departure_day)));?>
				<?php echo $day. '&nbsp;&nbsp;&nbsp;'?>
			<?php endforeach;?>
			</td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.departuredate_from'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('departuredate_from', date('d/m/Y', $tour->departuredate_from), 'class="inp-form" id="departuredate_from"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.departuredate_to'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('departuredate_to', date('d/m/Y', $tour->departuredate_to), 'class="inp-form" id="departuredate_to"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.credits'); ?><span class="require">*</span>:</th>
			<td><?php echo form_input('credits', $tour->credits, 'class="inp-form"'); ?></td>
		</tr>
		<tr style="display:none;">
			<th valign="top"><?php echo lang('tours.days'); ?><span class="require">*</span>:</th>
			<td><?php echo form_hidden('days', $tour->days, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.getin_type'); ?><span class="require">*</span>:</th>
			<td><?php echo form_dropdown('getin_type', array(lang('tours.bus') => lang('tours.bus'), lang('tours.airport') => lang('tours.airport')), $tour->getin_type, 'id="getin_type" class="select_box"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.priceof1r1p'); ?>:</th>
			<td><?php echo form_input('priceof1r1p', $tour->priceof1r1p, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.priceof1r2p'); ?>:</th>
			<td><?php echo form_input('priceof1r2p', $tour->priceof1r2p, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.priceof1r3p'); ?>:</th>
			<td><?php echo form_input('priceof1r3p', $tour->priceof1r3p, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.priceof1r4p'); ?>:</th>
			<td><?php echo form_input('priceof1r4p', $tour->priceof1r4p, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.order_rating'); ?>:</th>
			<td><?php echo form_input('order_rating', $tour->order_rating, 'class="inp-form"'); ?></td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('tours.image'); ?>:</th>
			<td>
			<input type="hidden" value="<?php echo $tour->image?>" name="image" id="pickup_image"/>
			<a href="<?php echo site_url('admin/folders/pickup_image')?>" id="a_pickup"><img src="<?php echo image_url('admin/shared/icon.png')?>"/></a>
			<div id="pickup_image_holder">
			<?php if(!empty($tour->image)):?>
				<a href="javascript:void(0);" onclick="delte_pickup_image()"><img src="<?php echo site_url('files/thumb/' . $tour->image . '/64/64?'. rand(0, 99)); ?>" title="click to delete"/></a>
			<?php endif;?>
			</div>
			</td>
		</tr>
		<tr>
			<th valign="top"><?php echo lang('global:sort'); ?>:</th>
			<td><?php echo form_input('sort', $tour->sort, 'class="inp-form"'); ?></td>
		</tr>
</table>	
<table border="0" cellpadding="0" cellspacing="0"  id="id-form" style="width:100%;">
		<tr>
			<th colspan="3">
			<div id="usual-tab" class="usual-tab">
				<ul class="idTabs"> 
					<?php foreach($supported_languages as $lang => $content): ?>
						<li><a href="#<?php echo $lang;?>"><span style="font-weight: bold; font-size:12px;"><?php echo $content['name'];?></span></a></li>
					<?php endforeach; ?>
				</ul>
				<?php foreach($supported_languages as $lang => $content): ?>
					<div id="<?php echo $lang;?>" class="lang_content">
						<fieldset>
							<table border="0" cellpadding="0" cellspacing="0"  id="id-form" style="width:100%;">
							<tr>
								<th valign="top"><?php echo lang('tours.name_label'); ?><span class="require">*</span>:</th>
								<td><?php echo form_input('name_'. $lang, def_lang($tour, 'name'), 'class="inp-form"'); ?></td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('tours.highlights'); ?>:</th>
								<td><?php echo form_textarea('highlights_'. $lang, def_lang($tour, 'highlights'), 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('highlights_'. $lang)); ?>
								</td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('tours.considerations'); ?>:</th>
								<td><?php echo form_textarea('considerations_'. $lang, def_lang($tour, 'considerations'), 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('considerations_'. $lang)); ?>
								</td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('tours.price_inclusions'); ?>:</th>
								<td><?php echo form_textarea('price_inclusions_'. $lang, def_lang($tour, 'price_inclusions'), 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('price_inclusions_'. $lang)); ?>
								</td>
							</tr>
							<tr>
								<th valign="top"><?php echo lang('tours.price_exclusions'); ?>:</th>
								<td><?php echo form_textarea('price_exclusions_'. $lang, def_lang($tour, 'price_exclusions'), 'class="form-textarea"'); ?>
								<?php echo display_ckeditor(ck_config_simple('price_exclusions_'. $lang)); ?>
								</td>
							</tr>
							</table>
						</fieldset>	
					</div> 
				<?php endforeach; ?> 
			</div> 
			</th>
		</tr>
	<tr>
		<th>&nbsp;</th>
		<td valign="top">
			<input type="submit" value="" class="form-submit" />
			<input type="reset" value="" class="form-reset"  />
		</td>
		<td></td>
	</tr>
	</table>
	<input type="hidden" name="id" value="<?php echo $tour->id?>"/>
</form>	
